package com.itmentu.service.impl;

import com.itmentu.mapper.UserInfoMapper;
import com.itmentu.pojo.UserInfo;
import com.itmentu.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author：http://www.itmentu.com
 * @date： 2021/12/5 17:55
 * @Description：
 ***/
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    @Override
    public List<UserInfo> findAll() {
        return userInfoMapper.findAll();
    }


    @Transactional
    @Override
    public int update(UserInfo userInfo) {
        int count = userInfoMapper.update(userInfo);
        //受影响行数
        System.out.println("受影响行数--->"+count);
        //制造异常
        int q=10/0;
        return count;
    }
}
